<%@ page language="java" pageEncoding="utf-8" contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="ww" uri="webwork" %>
<div class="tree-panel" layouth="5">
<ul id="orgTree" class="ztree"></ul>
</div>
<div class="trigger close" onclick="$('.tree-panel').toggle();$(this).toggleClass('close');"></div>

<div layoutH="5" id="div_custom" class="table-div">
	<jsp:include page="dircustomtreemini.jsp"></jsp:include>
</div>

<script type="text/javascript">
var org_setting = {
		data : {
			simpleData : {
				enable : true
			}
		},
		async: {
			enable: true,
			url:"getOrgTree.action",
			autoParam:["id=id"],
			type:"post"
		},
		edit: {
			enable: true,
			showRemoveBtn: false,
			showRenameBtn: false,
			drag: {
				isCopy: false,
				isMove: true
			}
		},			
		callback : {
			onCheck : org_onCheck,
			onAsyncSuccess : function(event, treeId, treeNode, msg){
			var treeObj = $.fn.zTree.getZTreeObj(treeId);
			if(treeObj.getSelectedNodes().length==0){
				var nodes = treeObj.getNodes();
				treeObj.selectNode(nodes[0]);
			}
			}
		},
		check:{
			enable : true,
			chkStyle : "radio",
			radioType: "all",
		}
	};
function org_onCheck(e, treeId, treeNode) {
	var $form=$('#div_custom',$navTab.focus()).find("#custom_form");
	$("#parentId",$form).val(treeNode.id);
}
var rf_tree  = null;
using(['tree'],function(){
   org_setting.async.otherParam = ["checkedId", $("#parentId",$navTab.focus()).val()];
   rf_tree =  $.fn.zTree.init($("#orgTree",$navTab.focus()), org_setting);    
})

</script>